import moduleRegist from '@/utils/moduleRegist';
import {
  module as configpayerModule
} from './module';
import {
  module as configpayerItemsModule
} from '../configpayerItems/module';
const Merchants = resolve => {
  require(['./Merchants'], resolve);
};

const Institution = resolve => {
  require(['./Institution'], resolve);
};

const Products = resolve => {
  require(['./Products'], resolve);
};

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const AddForm = resolve => {
  require(['./AddForm'], resolve);
};

const DetailForm = resolve => {
  require(['./DetailForm'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'configManage',
    redirect: 'configManage/list',
    component: Layout,
    meta: {
      title: '配置设置',
      name: '配置设置',
      permission: '',
      componentName: 'ConfigpayerLayout',
      keepAlive: true,
      icon: '',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(configpayerModule);
      moduleRegist(configpayerItemsModule);
      next();
    },
    children: [{
      path: 'list',
      component: Merchants,
      meta: {
        title: '商户',
        name: '商户',
        breadcrumb: '商户',
        permission: 'invoice:taxpayer:query',
        keepAlive: true,
        componentName: 'ConfigpayerListView',
        icon: ''
      }
    },
    {
      path: 'add',
      component: AddForm,
      meta: {
        title: '添加商户',
        name: '添加商户',
        breadcrumb: '添加商户',
        permission: 'invoice:taxpayer:add',
        show: false,
        keepAlive: true,
        componentName: 'ConfigpayerAddView',
        icon: ''
      }
    },
    {
      path: 'detail/:id',
      component: DetailForm,
      meta: {
        title: '商户详细',
        name: '商户详细',
        breadcrumb: '商户详细',
        permission: 'invoice:taxpayer:detail',
        show: false,
        keepAlive: true,
        componentName: 'ConfigpayerDetailView',
        icon: ''
      }
    },
    {
      path: 'institution',
      component: Institution,
      meta: {
        title: '组织机构',
        name: '组织机构',
        breadcrumb: '组织机构',
        permission: 'invoice:taxpayer:add',
        show: true,
        keepAlive: true,
        componentName: 'ConfigpayerAddView',
        icon: ''
      }
    },
    {
      path: 'products',
      component: Products,
      meta: {
        title: '产品',
        name: '产品',
        breadcrumb: '产品',
        permission: 'invoice:taxpayer:detail',
        show: true,
        keepAlive: true,
        componentName: 'ConfigpayerDetailView',
        icon: ''
      }
    }]
  }
];
